<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>素材视频</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<script src="js/remstyle.js"></script>
		<link rel="stylesheet" href="assets/mui/css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/min_page.css" />
		<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />
		<link rel="stylesheet" type="text/css" href="css/material_video.css" />
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<script src="js/config.js"></script>
	</head>
	<style>
		.phone_bottom {
			position: fixed;
			width: 100%;
			height: 1rem;
			line-height: 1rem;
			background: #fff;
			bottom: 0;
			left: 0;
			display: flex;
			font-size: 0.28rem;
		}
		
		.phone_bottom button {
			width: 50%;
			height: 1rem;
			line-height: 1rem;
			border-radius: inherit;
			border: none;
		}
		
		.phone_bottom button:last-child {
			background: #1f8ff3;
			color: #fff;
		}
	</style>

	<body>
		<!--顶部-->
		<div class="top">
			<div class="top-one" onclick="javascript :history.back(-1);">
				<span><img src="img_page/right.png"/></span>
			</div>
			<div class="point">
				<img src="img_page/3point.png" />
			</div>
		</div>
		<!--内容-->
		<div id="video_con">
			<div class="video_list" v-for="v in video_list" @click="choose_myvideo(v.url)">
				<div class="video_list_left" @click="open_video(v.url)">
					<img class="video_list_img" src="img_page/video_icon.png" />
				</div>
				<div class="video_list_right">
					<span>{{v.video_name}}</span>
					<span>{{v.create_time}}</span>
				</div>

			</div>
		</div>
		<!--弹出层-->
		<div id="bgMask" class="bg" style="display: none;"></div>
		<!--弹出层内容-->
		<div id="infoBox" style="display: none;width: 100%;height: 380px;" class="infobox_del">
			<img class="close_video" src="img_page/close.png" onclick="close_video()" />
			<iframe width="100%" height="380px" src="" frameborder=0 allowfullscreen></iframe>
		</div>

		<!--底部-->
		<div class="phone_bottom">
			<button onclick="phone_manage()">上传</button>
			<button onclick="new_phone()">管理</button>
		</div>

	</body>
	<script>
		var aaaa = window.location.href;
		var bbbb = aaaa.substring(aaaa.indexOf('addToTo=') + 8,aaaa.length);
		function phone_manage() {
			window.location.href = 'material_video_edit.html?c_user_id=' + c_user_id
		}

		function new_phone() {
			window.location.href = 'material_video_manage.html?c_user_id=' + c_user_id
		}
		var video_list = new Vue({
			el: '#video_con',
			data: {
				video_list: []
			},
			created: function() {
				this.getList();
			},
			methods: {

				getList: function() {
					var that = this;
					$.ajax({
						type: "get",
						url: v_url + "/wechat/material/getVideoList",
						data: {
							c_user_id: c_user_id
						},
						async: true,
						success: function(res) {
							var list = res.data;
							for(var i = 0; i < list.length; i++) {
								var video_time = list[i]["create_time"];
								var dateee = new Date(video_time).toJSON();
								var date = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
								list[i]["create_time"] = date;
								console.log(date)
							}
							that.video_list = list
							console.log(that.video_list);

						}
					});

				},

				open_video: function(e) {
					console.log(e);
					//显示背景遮罩
					document.getElementById("bgMask").style.display = "block";
					//显示消息弹出框
					document.getElementById("infoBox").style.display = "block";
					var src = e;
					$("#infoBox").find("iframe").attr("src", src);

				},
				choose_myvideo: function(url) {
					var html = "<iframe  width='100%' height='380px' src='" + url + "' frameborder=0 allowfullscreen></iframe>"
					if(v_param) {
						$.ajax({
							type: "get",
							url: v_url + "/wechat/singlepage/saveContent",
							data: {
								id: v_param,
								content: html,
								c_user_id: c_user_id
							},
							async: false,
							success: function(res) {
								if(res.code == 200) {
									console.log("保存成功")
									window.location.href = bbbb;
								} else {
									console.log("保存失败")
								}
							}
						});
					}
				}

			}
		})
		//		function open_video(){
		//			//显示背景遮罩
		//				document.getElementById("bgMask").style.display = "block";
		//				//显示消息弹出框
		//				document.getElementById("infoBox").style.display = "block";
		//				var src="http://player.youku.com/embed/XMzg0MTE2NjAxNg==";
		//				$("#infoBox").find("iframe").attr("src",src);
		//				
		//		}
		function close_video() {
			//显示背景遮罩
			document.getElementById("bgMask").style.display = "none";
			//显示消息弹出框
			document.getElementById("infoBox").style.display = "none";
		}
	</script>

</html>